/**********************************
 * @Author: Your Name
 * @LastEditor: Your Name
 * @LastEditTime: 2025-11-07
 * Copyright © 2025 Your Name
 **********************************/

// 开放API管理相关Mock数据
export const apiManagementMockData = {
  // API密钥列表
  apiKeys: [
    {
      id: 1,
      name: '前端应用API密钥',
      description: '用于前端应用访问后端API',
      apiKey: 'api_key_fe1234567890',
      secretKey: 'secret_key_fe1234567890abcd',
      status: 'ENABLED',
      expireTime: null,
      permissions: ['READ_PROJECT', 'READ_USER', 'UPLOAD_FILE'],
      ipWhitelist: ['192.168.1.0/24', '10.0.0.1'],
      ipBlacklist: [],
      rateLimitConfig: {
        requestsPerSecond: 100,
        requestsPerMinute: 1000,
        requestsPerHour: 10000,
      },
      ownerId: 1,
      createdBy: 1,
      updatedBy: 1,
      createdAt: '2025-01-01T10:00:00.000+08:00',
      updatedAt: '2025-01-01T10:00:00.000+08:00',
    },
    {
      id: 2,
      name: '移动端API密钥',
      description: '用于移动端应用访问后端API',
      apiKey: 'api_key_mobile123456',
      secretKey: 'secret_key_mobile123456efgh',
      status: 'ENABLED',
      expireTime: '2025-12-31T23:59:59.000+08:00',
      permissions: ['READ_PROJECT', 'READ_USER', 'UPLOAD_FILE', 'DOWNLOAD_FILE'],
      ipWhitelist: ['0.0.0.0/0'],
      ipBlacklist: ['192.168.2.100'],
      rateLimitConfig: {
        requestsPerSecond: 50,
        requestsPerMinute: 500,
        requestsPerHour: 5000,
      },
      ownerId: 2,
      createdBy: 2,
      updatedBy: 2,
      createdAt: '2025-01-02T10:00:00.000+08:00',
      updatedAt: '2025-01-02T10:00:00.000+08:00',
    },
    {
      id: 3,
      name: '后端服务API密钥',
      description: '用于后端服务间调用',
      apiKey: 'api_key_backend7890',
      secretKey: 'secret_key_backend7890ijkl',
      status: 'DISABLED',
      expireTime: null,
      permissions: ['READ_ALL', 'WRITE_ALL'],
      ipWhitelist: ['192.168.1.0/16'],
      ipBlacklist: [],
      rateLimitConfig: {
        requestsPerSecond: 500,
        requestsPerMinute: 5000,
        requestsPerHour: 50000,
      },
      ownerId: 1,
      createdBy: 1,
      updatedBy: 1,
      createdAt: '2025-01-03T10:00:00.000+08:00',
      updatedAt: '2025-01-03T10:00:00.000+08:00',
    },
    {
      id: 4,
      name: '第三方集成API密钥',
      description: '用于第三方系统集成',
      apiKey: 'api_key_third123456',
      secretKey: 'secret_key_third123456mnop',
      status: 'ENABLED',
      expireTime: '2025-06-30T23:59:59.000+08:00',
      permissions: ['READ_PROJECT'],
      ipWhitelist: ['203.0.113.0/24'],
      ipBlacklist: [],
      rateLimitConfig: {
        requestsPerSecond: 10,
        requestsPerMinute: 100,
        requestsPerHour: 1000,
      },
      ownerId: 3,
      createdBy: 3,
      updatedBy: 3,
      createdAt: '2025-01-04T10:00:00.000+08:00',
      updatedAt: '2025-01-04T10:00:00.000+08:00',
    },
  ],

  // API使用统计
  apiUsageStats: [
    {
      id: 1,
      apiKeyId: 1,
      date: '2025-03-01T00:00:00.000+08:00',
      hour: 0,
      totalRequests: 1250,
      successfulRequests: 1200,
      failedRequests: 50,
      avgResponseTime: 125.5,
      totalTraffic: 1024000, // 1MB
      errorStats: { 401: 20, 403: 15, 500: 15 },
    },
    {
      id: 2,
      apiKeyId: 1,
      date: '2025-03-02T00:00:00.000+08:00',
      hour: 0,
      totalRequests: 1320,
      successfulRequests: 1280,
      failedRequests: 40,
      avgResponseTime: 130.2,
      totalTraffic: 1105920, // 1.05MB
      errorStats: { 401: 15, 403: 10, 500: 15 },
    },
    {
      id: 3,
      apiKeyId: 2,
      date: '2025-03-01T00:00:00.000+08:00',
      hour: 0,
      totalRequests: 890,
      successfulRequests: 870,
      failedRequests: 20,
      avgResponseTime: 98.7,
      totalTraffic: 737280, // 0.7MB
      errorStats: { 401: 10, 403: 5, 500: 5 },
    },
    {
      id: 4,
      apiKeyId: 2,
      date: '2025-03-02T00:00:00.000+08:00',
      hour: 0,
      totalRequests: 950,
      successfulRequests: 930,
      failedRequests: 20,
      avgResponseTime: 102.3,
      totalTraffic: 786432, // 0.75MB
      errorStats: { 401: 12, 403: 3, 500: 5 },
    },
  ],

  // 访问控制选项
  accessControlOptions: [
    { name: 'IP白名单', value: 'IP_WHITELIST' },
    { name: 'IP黑名单', value: 'IP_BLACKLIST' },
    { name: '时间窗口控制', value: 'TIME_WINDOW' },
    { name: '请求频率限制', value: 'RATE_LIMIT' },
  ],

  // 权限选项
  permissionOptions: [
    { name: '读取项目', value: 'READ_PROJECT' },
    { name: '写入项目', value: 'WRITE_PROJECT' },
    { name: '删除项目', value: 'DELETE_PROJECT' },
    { name: '读取用户', value: 'READ_USER' },
    { name: '写入用户', value: 'WRITE_USER' },
    { name: '上传文件', value: 'UPLOAD_FILE' },
    { name: '下载文件', value: 'DOWNLOAD_FILE' },
    { name: '读取全部', value: 'READ_ALL' },
    { name: '写入全部', value: 'WRITE_ALL' },
  ],
}
